{extend name="layout/common_layout" /}
{block name="body"}
    <!--tab标签-->
    <div class="layui-tab layui-tab-brief">
        <ul class="layui-tab-title">
            <li class="layui-this">规格管理</li>

        </ul>
        <div class="layui-tab-content">

            <form class="layui-form layui-form-pane" action="{:url('admin/article/index')}" method="get">


                <div class="layui-inline">
                    <label class="layui-form-label">规格名称</label>
                    <div class="layui-input-inline">
                        <input type="text" name="keyword" value="{$keyword}" placeholder="请输入规格名称" class="layui-input">
                    </div>
                </div>
                <div class="layui-inline">
                    <button class="layui-btn">增加</button>
                </div>
            </form>
            <hr>

            <form action="" method="post" class="ajax-form">

                <button type="button" class="layui-btn layui-btn-danger layui-btn-small ajax-action" data-action="{:url('admin/article/delete')}">删除</button>
                <div class="layui-tab-item layui-show">
                    <table class="layui-table">
                        <thead>
                        <tr>
                            <th style="width: 15px;"><input type="checkbox" class="check-all"></th>
                            <th style="width: 30px;">ID</th>
                            <th>名称</th>
                            <th>时间</th>
                        </tr>
                        </thead>
                        <tbody>
                        {foreach name="article_list" item="vo"}
                        <tr>
                            <td><input type="checkbox" name="ids[]" value="{$vo.id}"></td>
                            <td>{$vo.id}</td>
                            <td>{$vo.sort}</td>
                            <td>{$vo.title}</td>
                            <td>{$category_list[$vo['cid']]}</td>
                            <td>{$vo.author}</td>
                            <td>{$vo.reading}</td>
                            <td>{php}echo $vo['status']==1 ? '已审核' : '未审核';{/php}</td>
                            <td>{$vo.publish_time}</td>
                            <td>
                                {php}
                                $url = url('admin/article/topToggle',['id'=>$vo['id']]);
                                if($vo['is_top']==1){
                                echo '<a href="'.$url.'" data-param="is_top=0" class="layui-btn layui-btn-primary layui-btn-mini ajax-post">取消置顶</a>';
                                }else{
                                echo '<a href="'.$url.'" data-param="is_top=1" class="layui-btn layui-btn-danger layui-btn-mini ajax-post">置顶</a>';
                                }
                                if($vo['is_hot']==1){
                                echo '<a href="'.$url.'" data-param="is_hot=0" class="layui-btn layui-btn-warm layui-btn-mini ajax-post">取消加精</a>';
                                }else{
                                echo '<a href="'.$url.'" data-param="is_hot=1" class="layui-btn layui-btn-danger layui-btn-mini ajax-post">加精</a>';
                                }
                                $url = url('admin/article/topToggle',['id'=>$vo['id']]);
                                if($vo['is_download']==1){
                                echo '<a href="'.$url.'" data-param="is_download=0" class="layui-btn layui-btn-normal layui-btn-mini ajax-post">取消 荐-下载</a>';
                                }else{
                                echo '<a href="'.$url.'" data-param="is_download=1" class="layui-btn layui-btn-default layui-btn-mini ajax-post">荐-下载</a>';
                                }
                                {/php}
                            </td>
                            <td>
                                <a href="{:url('admin/article/edit',['id'=>$vo['id']])}" class="layui-btn layui-btn-normal layui-btn-mini">编辑</a>

                                <a href="{:url('admin/article/delete',['id'=>$vo['id']])}" class="layui-btn layui-btn-danger layui-btn-mini ajax-delete">删除</a>
                            </td>
                        </tr>
                        {/foreach}
                        </tbody>
                    </table>
                    <!--分页-->
                    {$article_list->render()}
                </div>
            </form>
        </div>
    </div>
{/block}